package yanjun.tool.validate.util;

import javax.validation.ConstraintViolation;
import java.util.Set;

public class ValidateFailErrorMessageBuilder {


    public static String build(Set<ConstraintViolation<Object>> constraintViolations)
    {
        StringBuilder stringBuilder=new StringBuilder();

        for(ConstraintViolation<Object> constraintViolation:constraintViolations)
        {
            String str= String.format("参数[%s]验证失败：%s ",constraintViolation.getPropertyPath().toString(),constraintViolation.getMessage());
            stringBuilder.append(str+"\n");
        }
        return stringBuilder.toString();
    }
}
